package cn.lg.soar.system.general.entity;

import cn.lg.soar.common.data.dict.IDict;
import cn.lg.soar.database.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@ApiModel(value = "字典数据", description = "字典数据信息表")
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@TableName("lg_sys_dict_item")
public class DictItem extends BaseEntity implements IDict<Integer> {

    private static final long serialVersionUID = 3405401357379450916L;
    @ApiModelProperty(value = "主键id")
    @TableId
    private Long id;

    @ApiModelProperty(value = "字典Id")
    private Long dictId;

    @ApiModelProperty(value = "字典值")
    private Integer value;

    @ApiModelProperty(value = "字典标签")
    private String label;

    @ApiModelProperty(value = "元数据（可配置其他参数）")
    private String metadata;

    @ApiModelProperty(value = "是否禁用")
    private Boolean disabled;

    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "是系统枚举类的")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Boolean enumerated;

    @Override
    public Integer getValue() {
        return value;
    }

    @JsonIgnore
    @Override
    public Serializable primaryKey() {
        return this.id;
    }
}
